Skip to content

qt5,rpi_ws281x,hyperion,hyperhdr: fix Qt5 cross-compilation build - #11460

Merged
HiassofT merged 5 commits into
LibreELEC:masterfrom
heitbaum:qt5
Jun 11, 2026
Merged

qt5,rpi_ws281x,hyperion,hyperhdr: fix Qt5 cross-compilation build#11460
HiassofT merged 5 commits into
LibreELEC:masterfrom
heitbaum:qt5

Conversation

@heitbaum

Copy link
Copy Markdown
Contributor

Summary

qt5

Two configure problems:

1. -sysroot "${SYSROOT_PREFIX}" caused make install to write to the live sysroot. Qt's build system uses INSTALL_ROOT as its staging variable (not DESTDIR); with -sysroot set, the default install bypassed staging entirely. Fix: remove -sysroot from configure and pass INSTALL_ROOT="${INSTALL}" to make install.

2. -hostprefix "${TOOLCHAIN}" baked the toolchain directory path into the generated cmake config files (Qt5CoreConfigExtras.cmake). Paths to moc, mkspecs etc. were stored relative to the toolchain, making them unresolvable from the staging area. Using -hostprefix /usr/host (a subdirectory of -prefix /usr) keeps all cmake config paths self-contained within the staging area: Qt uses QT_HOST_DATA_RELATIVE to reference host items as host/... relative to the install prefix. Host tools land in usr/host/bin/, target libraries in usr/lib/, cleanly separated.

rpi_ws281x

The source tree ships a plain-text version file in its root. When the directory is added to the compiler include path (as both hyperion and hyperhdr do), #include <version> - used by Qt5's qstdlibdetection.h - finds this file instead of the C++20 standard library header, producing error: stray '.' in program.

hyperion / hyperhdr

Qt5 installs outside the sysroot (was suppose to given PKG_BUILD_FLAGS="-sysroot"). LibreELEC's cmake toolchain sets CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY, so cmake cannot find Qt5's config files without an explicit path hint.

Generate a thin wrapper toolchain file in pre_configure_target() that include()s the real LibreELEC toolchain then appends Qt5's staging prefix to CMAKE_FIND_ROOT_PATH. Passing -DCMAKE_TOOLCHAIN_FILE= via PKG_CMAKE_OPTS_TARGET overrides the default (last occurrence wins in cmake's command-line processing).

Test plan

  • Clean build on aarch64 — hyperion/hyperhdr
  • Clean build on arm — hyperion/hyperhdr
  • Clean build on x86_64 — hyperion/hyperhdr

heitbaum added 3 commits June 11, 2026 11:41
Qt's build system uses INSTALL_ROOT as its staging variable, not DESTDIR.
With -sysroot in configure the default make install wrote to the live
sysroot; removing -sysroot and using INSTALL_ROOT="${INSTALL}" fixes that.

With -hostprefix "${TOOLCHAIN}" the generated cmake config files stored
mkspecs and host-tool paths referencing the toolchain directory, making
them unresolvable from the staging area.

Using -hostprefix /usr/host (a subdirectory of -prefix /usr) keeps all
paths self-contained within the staging area: host tools and mkspecs land
in usr/host/ while target libraries land in usr/lib/, cleanly separated.
The cmake configs use QT_HOST_DATA_RELATIVE to reference host items as
"host/..." relative to the install prefix, so they resolve correctly from
the staging area without symlinks or path fixups.
The source tree ships a plain-text version file in its root directory.
When the directory is on a compiler include path, #include <version> (used
by Qt5's qstdlibdetection.h) finds this file instead of the C++ standard
library header and fails to compile with "error: stray '.' in program".

Carry a patch to rename version to VERSION (safe on case-sensitive Linux)
and update the file(READ) call in CMakeLists.txt. hyperhdr processes
rpi_ws281x via add_subdirectory so cmake still reads the version data;
hyperion compiles the sources directly and is unaffected either way.

Patch submitted upstream: https://github.com/jgarff/rpi_ws281x pull 570
Drop this patch when the upstream PR is merged and PKG_VERSION is bumped.
@HiassofT

Copy link
Copy Markdown
Member

please also bump PKG_REVs of hyperhdr and hyperion

heitbaum added 2 commits June 11, 2026 13:53
Qt5 is built with -sysroot removed and installs entirely under its own
staging prefix rather than into the sysroot. The default cmake toolchain
file sets CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY, so cmake cannot find
Qt5's config files outside CMAKE_FIND_ROOT_PATH.

Generate a thin wrapper toolchain file that includes the real LE toolchain
and appends Qt5's staging prefix to CMAKE_FIND_ROOT_PATH. Pass this via
PKG_CMAKE_OPTS_TARGET so it overrides the default toolchain file.
Same fix as hyperion: generate a thin cmake toolchain wrapper that
includes the real LE toolchain and appends Qt5's staging prefix to
CMAKE_FIND_ROOT_PATH so cmake can locate Qt5's config files.
@heitbaum

Copy link
Copy Markdown
Contributor Author

bumped

@HiassofT
HiassofT merged commit 65f5cf8 into LibreELEC:master Jun 11, 2026
@heitbaum
heitbaum deleted the qt5 branch June 11, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] qtbase build installs in sysroot (it shouldn’t)

2 participants